package com.ctshk.app.user.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.common.model.TokenUser;
import com.ctshk.common.utils.EntityUtil;
import com.ctshk.rpc.custom.dto.client.ClientInquiryListDTO;
import com.ctshk.rpc.custom.req.client.ClientInquiryListReq;
import com.ctshk.rpc.custom.service.ICustomizedTripScheduleInformationService;
import com.ctshk.rpc.user.req.MyClientInquiryListReq;
import com.ctshk.rpc.user.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *  我的预约
 * </p>
 *
 * @author 李新科
 * @date 2021/5/27 11:46
 */
@Api(value="我的预约", tags="我的预约")
@RestController
@RequestMapping("/reservation")
public class ReservationController extends AppBaseController {

    @DubboReference
    private ICustomizedTripScheduleInformationService customizedTripScheduleInformation;

    @DubboReference
    private IUserService userService;

    @ApiOperation(value="我的預約咨詢（C端）", notes="我的預約咨詢列表（C端）")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "我的預約咨詢列表（C端）", operDesc = "我的預約咨詢列表（C端）")
    @PostMapping("/list")
    public PageResponse<ClientInquiryListDTO> list(@RequestBody @Valid MyClientInquiryListReq req){
        TokenUser currentUser = getCurrentUser();
        req.setUserId(currentUser.getId());
        ClientInquiryListReq listReq = EntityUtil.copy(req, ClientInquiryListReq.class);
        return customizedTripScheduleInformation.list(listReq);
    }
}
